#pragma once

#include "xKernel/IxView.h"
#include "xKernel/IxMsgDispatcher.h"

[
    default(IxMsgDispatcher),
    threading(free),
    uuid("BF72F6B4-4CFA-4a8d-BD23-9E1DF8F2C44F"),
    coclass
]
class CxMsgDispatcher : public IxMsgDispatcher
{
    typedef std::vector< CComPtr<IxView> >  VIEWS;
public:
    CxMsgDispatcher();
    virtual ~CxMsgDispatcher();

    // interface of IxMsgDispatcher
    HRESULT Initialize(IxView* pRootView);
    HRESULT Uninitialize();
    HRESULT DispatchMessage(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lpRet, LPBOOL pbHandled);

protected:
    LRESULT OnMouseMove(WPARAM wParam, LPARAM lParam, LPBOOL pbHandled);

protected:
    CComPtr<IxView>     m_spRootView;

    VIEWS               m_vecViews;
};